Programming Basics
Constructs Variable Exercise
These exercises are designed to evaluate your knowledge, comprehension and application of the programming constructs of variables. A couple of the problems evaluate your analysis and synthesis of the programming basics discussed so far. It is expected that you should be able to correctly answer all or nearly all of the questions and problems presented. You should do these exercises by yourself. This exercise represents the most foundational and elementary information to be mastered by anyone involved with computer programming.
1. Identify the types of variables the following most accurately represents. Take note of the format of the variable values and their range is relation to the common definitions of types given in the lecture material to make your decision.
Value |
Type |
123086 |
|
true |
|
0 |
|
F0001320DC657AA9 |
|
Hello World |
|
10000000 |
|
-543287.12032222 |
|
436 |
|
Z |
|
255 |
|
5,000,000,000 |
|
-511 |
|
? |
|
0FED1200 |
|
false |
|
-3,000,000,000 |
|
Java |
|
4523.346 |
2. Identify what component(s) of an array (name, type, values, index) the following are:
Name Type Value Index
[2] ____ ____ _____ _____
char ____ ____ _____ _____
int ____ ____ _____ _____
a[] ____ ____ _____ _____
ABC[] ____ ____ _____ _____
"Dog" ____ ____ _____ _____
Fred[] ____ ____ _____ _____
-1 ____ ____ _____ _____
[0] ____ ____ _____ _____
23.4 ____ ____ _____ _____
"Cat" ____ ____ _____ _____
String ____ ____ _____ _____
3. What is the relationship between slots of an array and the index?
4. Could you have a single array that has the integer 3, the String "Gator" and the double 453.238 in it? Why or Why not?
5. Assume I have one single dimensional array with N slots. How many different values can I have at the same time at:
Index 0?
Index 5?
Index N-1?
Index N?